/**
 * 
 */
package com.beta.admin.support;

import org.springframework.context.annotation.Bean;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author vector
 *
 */
@EnableSwagger2
public class ApiDocumentConfig {

	@Bean
	public Docket createRestApi() {
		return new Docket(DocumentationType.SWAGGER_2)
				.apiInfo(apiInfo())
				.select()
				.apis(RequestHandlerSelectors.basePackage("com.beta.admin.controller"))
				.paths(PathSelectors.any())
				.build();
	}

	private ApiInfo apiInfo() {
		StringBuilder descriptionBuilder = new StringBuilder()
				.append("管理端数据接口");
		
		return new ApiInfoBuilder()
				.version("1.0.0")
				.title("管理端数据接口")
				.description(descriptionBuilder.toString())
				.contact(new Contact("Develop", null, "vector_ding@live.cn"))
				// .termsOfServiceUrl("http://www.huamengtong.cn")
				.build();
	}

}
